#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

 void QuickSort(int* arr, int left, int right)
{
	 if (left >= right) return;
	 int mid = (left + right) >> 1;
	 int key = arr[mid];
	 int l = left - 1; int r = right + 1;
	 while (l < r){
		 do l++; while (arr[l] < key);
		 do r--; while (arr[r] > key);
		 if(l<r)swap(arr[l], arr[r]);
	}
	 QuickSort(arr, left, r); QuickSort(arr, r+1, right);
}

 int main(){
	 int a[] = { 1,2,5,7,3,8,5,88,44,24 };
	 QuickSort(a, 0, sizeof(a)/sizeof(int)-1);
	 for (int i=0;i< sizeof(a) / sizeof(int);i++)
		 printf("%d ", a[i]);
	 return 0;
 }